<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>

<input type="hidden" value="<%=basePath%>" id="basePath">
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css"
          href="<%=basePath%>/assets/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet"
          href="<%=basePath%>/assets/bootstrap/css/bootstrap.css"/>
    <script type="text/javascript"
            src="<%=basePath%>/assets/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript"
            src="<%=basePath%>/assets/bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript"
            src="<%=basePath%>/assets/lib/layer/2.4/layer.js"></script>
    <script src="<%=basePath%>/assets/js/exam/exam-update.js"
            type="text/javascript" charset="utf-8"></script>
    <title>试题管理</title>
    <style type="text/css">
        .objectSinglePloy {
            appearance: none;
            -moz-appearance: none;
            -webkit-appearance: none;
            height: 34px;
            width: 33%;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
            -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
        }

        .answerPoint {
            padding-left: 10px;
        }

        .waring {
            position: fixed;
            top: 23%;
            right: 5%;
            min-height: 80px;
            width: 15%;
            padding: 6px 8px;
            box-shadow: 10px 20px 35px;
        }

        .notice {
            padding: 3px 0px 8px 10px;
        }
    </style>
</head>
<body>
<br>
<div class="alert alert-warning alert-dismissible waring" role="alert">
    <h4 class="text-center">注意</h4>
    <ul class="notice">
        <li>试题分类不可修改；</li>
        <li>修改后的试题题干不可与已存在的试题题干相同，系统将会对此进行验证；</li>
    </ul>
</div>

<div class="container-fluid">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="tabbable" id="tabs-576364">
                <ul class="nav nav-tabs">
                    <li><a>第一站问答</a></li>
                    <li <c:if test="${examDetails.examination.category == 5 or examDetails.examination.category == 6}">class="active"</c:if>><a>第二站常规化</a></li>
                    <li <c:if test="${examDetails.examination.category == 14}">class="active"</c:if>><a>第二站常规化</a></li>
                </ul>
                <br/>
                <div class="tab-content">
                    <!--第一站问答-->
                    <div class="tab-pane active" id="panel-872798">
                        <form class="form-horizontal" method="post" id="examForm">
                            <!-- 发送题目id -->
                            <input type="hidden" name="id" value="${examDetails.examination.id}" required="required" id="secondId">
                            <!-- 题目分类 -->
                            <input type="hidden" name="category" value="${examDetails.examination.category}" id="categoryTwo"/>
                            <div class="col-md-9">
                                <!--试题分类-->
                                <c:if test="${examDetails.examination.category == 5}">
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">分类</label>
                                        <div class="col-md-2">
                                            <select class="form-control" disabled="disabled">
                                                <option value="穴位定位" selected="selected">穴位定位</option>
                                            </select>
                                        </div>
                                        <div class="col-md-2">
                                            <select class="form-control" disabled="disabled">
                                                <option>成人穴位</option>
                                            </select>
                                        </div>
                                    </div>
                                </c:if>
                                <c:if test="${examDetails.examination.category == 6}">
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">分类</label>
                                        <div class="col-md-2">
                                            <select id="nomalSelectCategory" class="form-control" disabled="disabled">
                                                <option value="穴位定位" selected="selected">穴位定位</option>
                                            </select>
                                        </div>
                                        <div class="col-md-2">
                                            <select class="form-control" disabled="disabled">
                                                <option>儿科穴位</option>
                                            </select>
                                        </div>
                                    </div>
                                </c:if>
                                <c:if test="${examDetails.examination.category == 14}">
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">分类</label>
                                        <div class="col-md-2">
                                            <select class="form-control" disabled="disabled">
                                                <option>客观化</option>
                                            </select>
                                        </div>
                                        <div class="col-md-2">
                                            <select class="form-control" disabled="disabled">
                                                <option>穴位定位</option>
                                            </select>
                                        </div>
                                    </div>
                                </c:if>

                                <!--题干-->
                                <div class="form-group">
                                    <label class="col-md-2 control-label">题干</label>
                                    <div class="col-md-9">
                                        <input type="text" name="stem" id="secondStem" class="form-control" value="${examDetails.examination.stem}"
                                               onblur="validateStemForUpdateExam('${examDetails.examination.id}',${examDetails.examination.category},this.value)" required/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-2 control-label">知识点</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="knowledgePoint" value="${examDetails.examination.knowledgePoint}" required/>
                                    </div>
                                    <label class="col-md-1 control-label answerPoint">总分</label>
                                    <div class="col-md-4">
                                        <input type="number" name="totalScore" class="form-control"
                                               value="${examDetails.examination.totalScore}" required/>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="col-md-2 control-label">大纲</label>
                                    <div class="col-md-4">
                                        <input type="text" class="form-control" name="outlineCode"
                                               value="${examDetails.examination.outlineCode}" required/>
                                    </div>

                                    <label class="col-md-1 control-label answerPoint">认知</label>
                                    <div class="col-md-4">
                                        <select id="cognitivelevel" name="cognitiveLevel" class="form-control">
                                            <option value="记忆"  <c:if test="${examDetails.examination.cognitiveLevel == \"记忆\"}"> selected</c:if> >记忆</option>
                                            <option value="理解" <c:if test="${examDetails.examination.cognitiveLevel == \"理解\"}"> selected</c:if>>理解</option>
                                            <option value="应用" <c:if test="${examDetails.examination.cognitiveLevel == \"应用\"}"> selected</c:if>>应用</option>
                                        </select>
                                    </div>
                                </div>

                                <!--部位-->
                                <div class="form-group firstStopAcupoints">
                                    <label class="col-sm-2 control-label">部位</label>
                                    <div class="col-sm-6">
                                        <c:if test="${examDetails.examination.category == 5 or examDetails.examination.category == 6}">
                                            <input type="text" class="form-control" name="part" value="${examDetails.examination.part}" required="required"/>
                                        </c:if>
                                        <c:if test="${examDetails.examination.category == 14}">
                                            <select name="partId" class="form-control">
                                                <option value="1"
                                                        <c:if test="${examDetails.examination.partId == 1}">selected</c:if> >头正面
                                                </option>
                                                <option value="2"
                                                        <c:if test="${examDetails.examination.partId == 2}">selected</c:if> >头侧面
                                                </option>
                                                <option value="3"
                                                        <c:if test="${examDetails.examination.partId == 3}">selected</c:if> >胸腹部
                                                </option>
                                                <option value="4"
                                                        <c:if test="${examDetails.examination.partId == 4}">selected</c:if> >侧胸部
                                                </option>
                                                <option value="5"
                                                        <c:if test="${examDetails.examination.partId == 5}">selected</c:if> >侧胸腹部
                                                </option>
                                                <option value="6"
                                                        <c:if test="${examDetails.examination.partId == 6}">selected</c:if> >背部
                                                </option>
                                                <option value="7"
                                                        <c:if test="${examDetails.examination.partId == 7}">selected</c:if> >肩背腰骶部
                                                </option>
                                                <option value="8"
                                                        <c:if test="${examDetails.examination.partId == 8}">selected</c:if> >上肢
                                                </option>
                                                <option value="9"
                                                        <c:if test="${examDetails.examination.partId == 9}">selected</c:if> >手部
                                                </option>
                                                <option value="10"
                                                        <c:if test="${examDetails.examination.partId == 10}">selected</c:if> >腿部
                                                </option>
                                                <option value="11"
                                                        <c:if test="${examDetails.examination.partId == 11}">selected</c:if> >足部
                                                </option>
                                            </select>
                                        </c:if>
                                    </div>
                                    <label class="col-sm-1 control-label answerPoint">分值</label>
                                    <div class="col-sm-2">
                                        <input type="number" class="form-control" value="${examDetails.examination.partScore}" name="partScore" required="required"/>
                                    </div>
                                </div>

                                <!--归经-->
                                <div class="form-group firstStopAcupoints">
                                    <label class="col-sm-2 control-label">归经</label>
                                    <div class="col-sm-6">
                                        <input type="text" class="form-control" name="meridian" value="${examDetails.examination.meridian}" required="required"/>
                                    </div>
                                    <label class="col-sm-1 control-label answerPoint">分值</label>
                                    <div class="col-sm-2">
                                        <input type="number" class="form-control" value="${examDetails.examination.meridianScore}" name="meridianScore" required="required"/>
                                    </div>
                                </div>

                                <!--定位-->
                                <div class="form-group firstStopAcupoints">
                                    <label class="col-sm-2 control-label">定位</label>
                                    <div class="col-sm-6">
                                        <input type="text" class="form-control" name="location" value="${examDetails.examination.location}" required="required"/>
                                    </div>
                                    <label class="col-sm-1 control-label answerPoint">分值</label>
                                    <div class="col-sm-2">
                                        <input type="number" class="form-control" value="${examDetails.examination.locationScore}" name="locationScore" required="required"/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-md-6" style="text-align: center;">
                                    <input class="btn btn-default" type="button"
                                           id="updateExam" value="修改"
                                           style="background-color: #008200; color: white;"/>
                                    <button class="btn btn-default" type="reset">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    $("#updateExam").click(function () {
        var id = $("#secondId").val();
        var category = $('#categoryTwo').val();
        var stem = $("#secondStem").val();


        var validateStem = validateStemForUpdateExam(id, category, stem);
        if (validateStem == false) {
            return false;
        }

        $.post('<%=basePath%>/examination/examinationUpdate', $("#examForm").serialize(), function (data) {
            if (data.code==0) {
                layer.msg(data.msg, {
                    icon: 1,
                    time: 3000
                });
            }
        },"json");
    });
</script>
</html>